<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core">

    <p:panel header="BIBLIOTECA - ALMACEN DE LAS PRACTICAS CULMINADAS CON ÉXITO" style="border: none;">
        <div align="center">
            <p><h:outputText value="DOCUMENTOS DE PRACTICAS" style="font-weight: bold; font-size: 18px; color:#069;"/></p>    

            <h:form>
                <p:dataTable var="rp" value="#{libraryBean.listReportPractice}"
                             filteredValue="#{libraryBean.listReportPracticeFilter}">
                    <f:facet name="header">
                        <h:outputText value="DOCUMENTOS"/>
                    </f:facet>
                    <p:column width="5" >
                        <p:commandButton id="downloadLink"   
                                         icon="ui-icon-disk"
                                         update=":modalReportPracId"
                                         oncomplete="modalReportPrac.show();">
                            <f:setPropertyActionListener value="#{rp}" target="#{libraryBean.reportPractice}"/>
                        </p:commandButton>
                    </p:column>
                    <p:column footerText="Código"> 
                        <h:outputText value="#{rp.idPractice.codeAlumn}"/>
                    </p:column>
                    <p:column footerText="Practicante" filterBy="idPractice.names" > 
                        <h:outputText value="#{rp.idPractice.names}"/>
                    </p:column>
                    <p:column footerText="Titlulo de Proyecto" filterBy="idPractice.titleProject">
                        <h:outputText value="#{rp.idPractice.titleProject}"/>
                    </p:column>
                </p:dataTable>
            </h:form>
        </div>
    </p:panel>


    <p:dialog modal="true" appendTo="@(body)" header="Detalle de Practica" id="modalReportPracId"
              widgetVar="modalReportPrac" width="350px" height="300px">
        <div align="center">
            <h:outputText value="TITULO" style="font-weight: bold; font-size: 18px; color:#069;"/><br/>
            <p>#{libraryBean.reportPractice.idPractice.titleProject}</p>
            
            <h:outputText value="DESCRIPCIÓN" style="font-weight: bold; font-size: 18px; color:#069;"/>
            <p>#{libraryBean.reportPractice.idPractice.summaryProject}</p>
            
            <h:form>
                <p:commandButton id="downloadLink"
                                 value="Descargar Practica"
                                 onclick="PrimeFaces.monitorDownload(start, stop);"   
                                 icon="ui-icon-arrowthichk-s">
                    <p:fileDownload value="#{libraryBean.getFileDowload()}" />  
                </p:commandButton>
            </h:form>
        </div>
    </p:dialog>

    <script type="text/javascript">
                                     function start() {
                                         PF('statusDialog').show();
                                     }

                                     function stop() {
                                         PF('statusDialog').hide();
                                     }
    </script>
</ui:composition>
